using Admin2025.Application.IServices;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace Admin2025.Api.Controllers;

[ApiController]
[Route("api/[controller]")]
[Authorize]
public class PermissionsController : ControllerBase
{
  private readonly IPermissionService _permissionService;

  public PermissionsController(IPermissionService permissionService)
  {
    _permissionService = permissionService;
  }

  [HttpGet("user/{id}")]
  public async Task<IActionResult> GetUserRoles(Guid id)
  {
    var roles = await _permissionService.GetUserRolesAsync(id);
    return Ok(roles);
  }
}